<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>lee-calendar Demo</title>

    <link href="./lee-calendar.css" rel="stylesheet">
    <style>
        .schedule-item {
            display: block;
            background: orange;
            padding: 2px 5px;
            margin: 2px;
            border-radius: 4px;
            color: #FFFFFF;
			text-decoration: none;
        }
        .schedule-item:hover{
            background: #05ff39;
        }
    </style>
</head>

<body class="gray-bg">
<div class="container-div">
    <div class="test">
        <div class="test-box">
        </div>
    </div>
</div>
<script src="./lib/jquery.min.js"></script>
<script src="./lee-calendar.js"></script>
<script>
    $(function () {
        var scheduleData = [];
        for (var i = 10; i < 31; i++) {
            var obj = {};
            obj.scheduleDate = "2021-12-" + i;
            var domList = [];
            for (var j = 0; j < 5; j++) {
                var ddom = $('<a class="schedule-item" href="javascript:;" onclick="showSomething('+ j +')">' + j + i + '</a>');
                domList.push(ddom);
            }
            obj.domList = domList;
            scheduleData.push(obj);
        }
        var scheduleData1 = [];
        for (var i = 1; i < 12; i++) {
            var obj = {};
            obj.scheduleDate = "2021-11-" + i;
            var domList = [];
            for (var j = 0; j < 5; j++) {
                var ddom = $('<a class="schedule-item" href="javascript:;" onclick="showSomething('+ j +')">' + j + i + '</a>');
                domList.push(ddom);
            }
            obj.domList = domList;
            scheduleData1.push(obj);
        }

      var cc =   $(".test-box").Calendar({
          calendarData:scheduleData,
          monthChange:onChangeMonth
        });


        function onChangeMonth() {
            alert("月份被切换为：" + cc.showDate.getFullYear() + "-"  + (cc.showDate.getMonth() +1));
            cc.setCalendarData(scheduleData1);
            cc.initData();
        }
    })



    function showSomething(s) {
        alert(s);//输出a标签的名字
    }
</script>
</body>

</html>
